/* ====================================== toast  ====================================== */
import { message } from 'ant-design-vue'
// ===================================================================== Select
message.config({ top: '40%', duration:3 })

window.addEventListener('click',()=>{
	message.destroy()
})

let clear 

const timeout =  f => {
	clearTimeout(clear)
	clear = setTimeout(f)
}

const Index = {
	success(msg, delay){
		timeout(()=>message.success(msg, delay))
	},
	error(msg, delay= 3){
		timeout(()=>message.error(msg, delay))
	},
	info(msg, delay){
		timeout(()=>message.info(msg, delay))
	},
	warning(msg, delay){
		timeout(()=>message.warning(msg, delay))
	},
	warn(msg, delay){
		timeout(()=>message.warn(msg, delay))
	},
	loading(msg, delay){
		timeout(()=>message.loading(msg, delay))
	}
}
export default Index